gtk-demo: Don't rely on gdk_cursor_get_image
authorMatthias Clasen <mclasen@redhat.com>
Tue, 12 May 2015 03:06:50 +0000 (23:06 -0400)
committerMatthias Clasen <mclasen@redhat.com>
Tue, 12 May 2015 03:06:50 +0000 (23:06 -0400)
This function is only implemented on X11. Instead,
just use a fixed set of cursor images from resources.

38 files changed:
demos/gtk-demo/Makefile.am
demos/gtk-demo/alias_cursor.png [new file with mode: 0644]
demos/gtk-demo/all_scroll_cursor.png [new file with mode: 0644]
demos/gtk-demo/cell_cursor.png [new file with mode: 0644]
demos/gtk-demo/col_resize_cursor.png [new file with mode: 0644]
demos/gtk-demo/copy_cursor.png [new file with mode: 0644]
demos/gtk-demo/crosshair_cursor.png [new file with mode: 0644]
demos/gtk-demo/cursors.c
demos/gtk-demo/default_cursor.png [new file with mode: 0644]
demos/gtk-demo/demo.gresource.xml
demos/gtk-demo/e_resize_cursor.png [new file with mode: 0644]
demos/gtk-demo/ew_resize_cursor.png [new file with mode: 0644]
demos/gtk-demo/grab_cursor.png [new file with mode: 0644]
demos/gtk-demo/grabbing_cursor.png [new file with mode: 0644]
demos/gtk-demo/hand_cursor.png [new file with mode: 0644]
demos/gtk-demo/help_cursor.png [new file with mode: 0644]
demos/gtk-demo/move_cursor.png [new file with mode: 0644]
demos/gtk-demo/n_resize_cursor.png [new file with mode: 0644]
demos/gtk-demo/ne_resize_cursor.png [new file with mode: 0644]
demos/gtk-demo/nesw_resize_cursor.png [new file with mode: 0644]
demos/gtk-demo/no_drop_cursor.png [new file with mode: 0644]
demos/gtk-demo/none_cursor.png [new file with mode: 0644]
demos/gtk-demo/not_allowed_cursor.png [new file with mode: 0644]
demos/gtk-demo/ns_resize_cursor.png [new file with mode: 0644]
demos/gtk-demo/nw_resize_cursor.png [new file with mode: 0644]
demos/gtk-demo/nwse_resize_cursor.png [new file with mode: 0644]
demos/gtk-demo/pointer_cursor.png [new file with mode: 0644]
demos/gtk-demo/progress_cursor.png [new file with mode: 0644]
demos/gtk-demo/row_resize_cursor.png [new file with mode: 0644]
demos/gtk-demo/s_resize_cursor.png [new file with mode: 0644]
demos/gtk-demo/se_resize_cursor.png [new file with mode: 0644]
demos/gtk-demo/sw_resize_cursor.png [new file with mode: 0644]
demos/gtk-demo/text_cursor.png [new file with mode: 0644]
demos/gtk-demo/vertical_text_cursor.png [new file with mode: 0644]
demos/gtk-demo/w_resize_cursor.png [new file with mode: 0644]
demos/gtk-demo/wait_cursor.png [new file with mode: 0644]
demos/gtk-demo/zoom_in_cursor.png [new file with mode: 0644]
demos/gtk-demo/zoom_out_cursor.png [new file with mode: 0644]

index d31e6bea5921aa96ba08be8158458f7ce4c06e25..f8b7c9f256c54ff004649cdfab987ffdc65c3ed0 100644 (file)
@@ -155,7 +155,43 @@ RESOURCES =                                \
        css_pixbufs.css                 \
        css_shadows.css                 \
        cssview.css                     \
-       reset.css
+       reset.css                       \
+       alias_cursor.png                \
+       all_scroll_cursor.png           \
+       cell_cursor.png                 \
+       col_resize_cursor.png           \
+       copy_cursor.png                 \
+       crosshair_cursor.png            \
+       default_cursor.png              \
+       e_resize_cursor.png             \
+       ew_resize_cursor.png            \
+       grabbing_cursor.png             \
+       grab_cursor.png                 \
+       hand_cursor.png                 \
+       help_cursor.png                 \
+       move_cursor.png                 \
+       ne_resize_cursor.png            \
+       nesw_resize_cursor.png          \
+       none_cursor.png                 \
+       no_drop_cursor.png              \
+       not_allowed_cursor.png          \
+       n_resize_cursor.png             \
+       ns_resize_cursor.png            \
+       nw_resize_cursor.png            \
+       nwse_resize_cursor.png          \
+       pointer_cursor.png              \
+       progress_cursor.png             \
+       row_resize_cursor.png           \
+       se_resize_cursor.png            \
+       s_resize_cursor.png             \
+       sw_resize_cursor.png            \
+       text_cursor.png                 \
+       vertical_text_cursor.png        \
+       wait_cursor.png                 \
+       w_resize_cursor.png             \
+       zoom_in_cursor.png              \
+       zoom_out_cursor.png
+
 
 iconthemedir = $(datadir)/icons/hicolor
 
diff --git a/demos/gtk-demo/alias_cursor.png b/demos/gtk-demo/alias_cursor.png
new file mode 100644 (file)
index 0000000..70a7956
Binary files /dev/null and b/demos/gtk-demo/alias_cursor.png differ
diff --git a/demos/gtk-demo/all_scroll_cursor.png b/demos/gtk-demo/all_scroll_cursor.png
new file mode 100644 (file)
index 0000000..b42ae85
Binary files /dev/null and b/demos/gtk-demo/all_scroll_cursor.png differ
diff --git a/demos/gtk-demo/cell_cursor.png b/demos/gtk-demo/cell_cursor.png
new file mode 100644 (file)
index 0000000..0bb0935
Binary files /dev/null and b/demos/gtk-demo/cell_cursor.png differ
diff --git a/demos/gtk-demo/col_resize_cursor.png b/demos/gtk-demo/col_resize_cursor.png
new file mode 100644 (file)
index 0000000..8dbd462
Binary files /dev/null and b/demos/gtk-demo/col_resize_cursor.png differ
diff --git a/demos/gtk-demo/copy_cursor.png b/demos/gtk-demo/copy_cursor.png
new file mode 100644 (file)
index 0000000..c2350b8
Binary files /dev/null and b/demos/gtk-demo/copy_cursor.png differ
diff --git a/demos/gtk-demo/crosshair_cursor.png b/demos/gtk-demo/crosshair_cursor.png
new file mode 100644 (file)
index 0000000..7247e06
Binary files /dev/null and b/demos/gtk-demo/crosshair_cursor.png differ
index 11889959d236fa6f076cb440533958e982736f79..1ccb580f27e4593c723dbef3953554edab9eca5a 100644 (file)
@@ -51,8 +51,15 @@ add_button (GtkWidget   *section,
   if (cursor == NULL)
     image = gtk_image_new_from_icon_name ("image-missing", GTK_ICON_SIZE_MENU);
   else
-    image = gtk_image_new_from_pixbuf (gdk_cursor_get_image (cursor));
-  gtk_widget_set_size_request (image, 24, 24);
+    {
+      gchar *path;
+
+      path = g_strdup_printf ("/cursors/%s_cursor.png", css_name);
+      g_strdelimit (path, "-", '_');
+      image = gtk_image_new_from_resource (path);
+      g_free (path);
+    }
+  gtk_widget_set_size_request (image, 32, 32);
   button = gtk_button_new ();
   gtk_container_add (GTK_CONTAINER (button), image);
   gtk_style_context_add_class (gtk_widget_get_style_context (button), "image-button");
diff --git a/demos/gtk-demo/default_cursor.png b/demos/gtk-demo/default_cursor.png
new file mode 100644 (file)
index 0000000..aa39aa4
Binary files /dev/null and b/demos/gtk-demo/default_cursor.png differ
index 91db2a526b84106bb6362b90c8966516a3bf2ce5..91f50b6e82ea6a01828c14e76ae4a13b2ee58eed 100644 (file)
     <file>cssview.css</file>
     <file>reset.css</file>
   </gresource>
+  <gresource prefix="/cursors">
+    <file>alias_cursor.png</file>
+    <file>all_scroll_cursor.png</file>
+    <file>cell_cursor.png</file>
+    <file>col_resize_cursor.png</file>
+    <file>copy_cursor.png</file>
+    <file>crosshair_cursor.png</file>
+    <file>default_cursor.png</file>
+    <file>e_resize_cursor.png</file>
+    <file>ew_resize_cursor.png</file>
+    <file>grabbing_cursor.png</file>
+    <file>grab_cursor.png</file>
+    <file>hand_cursor.png</file>
+    <file>help_cursor.png</file>
+    <file>move_cursor.png</file>
+    <file>ne_resize_cursor.png</file>
+    <file>nesw_resize_cursor.png</file>
+    <file>no_drop_cursor.png</file>
+    <file>none_cursor.png</file>
+    <file>not_allowed_cursor.png</file>
+    <file>n_resize_cursor.png</file>
+    <file>ns_resize_cursor.png</file>
+    <file>nw_resize_cursor.png</file>
+    <file>nwse_resize_cursor.png</file>
+    <file>pointer_cursor.png</file>
+    <file>progress_cursor.png</file>
+    <file>row_resize_cursor.png</file>
+    <file>se_resize_cursor.png</file>
+    <file>s_resize_cursor.png</file>
+    <file>sw_resize_cursor.png</file>
+    <file>text_cursor.png</file>
+    <file>vertical_text_cursor.png</file>
+    <file>wait_cursor.png</file>
+    <file>w_resize_cursor.png</file>
+    <file>zoom_in_cursor.png</file>
+    <file>zoom_out_cursor.png</file>
+  </gresource>
   <gresource prefix="/iconview">
     <file preprocess="to-pixdata">gnome-fs-directory.png</file>
     <file preprocess="to-pixdata">gnome-fs-regular.png</file>
diff --git a/demos/gtk-demo/e_resize_cursor.png b/demos/gtk-demo/e_resize_cursor.png
new file mode 100644 (file)
index 0000000..f06bf46
Binary files /dev/null and b/demos/gtk-demo/e_resize_cursor.png differ
diff --git a/demos/gtk-demo/ew_resize_cursor.png b/demos/gtk-demo/ew_resize_cursor.png
new file mode 100644 (file)
index 0000000..8dbd462
Binary files /dev/null and b/demos/gtk-demo/ew_resize_cursor.png differ
diff --git a/demos/gtk-demo/grab_cursor.png b/demos/gtk-demo/grab_cursor.png
new file mode 100644 (file)
index 0000000..a920eef
Binary files /dev/null and b/demos/gtk-demo/grab_cursor.png differ
diff --git a/demos/gtk-demo/grabbing_cursor.png b/demos/gtk-demo/grabbing_cursor.png
new file mode 100644 (file)
index 0000000..33418ac
Binary files /dev/null and b/demos/gtk-demo/grabbing_cursor.png differ
diff --git a/demos/gtk-demo/hand_cursor.png b/demos/gtk-demo/hand_cursor.png
new file mode 100644 (file)
index 0000000..b510203
Binary files /dev/null and b/demos/gtk-demo/hand_cursor.png differ
diff --git a/demos/gtk-demo/help_cursor.png b/demos/gtk-demo/help_cursor.png
new file mode 100644 (file)
index 0000000..5440fd9
Binary files /dev/null and b/demos/gtk-demo/help_cursor.png differ
diff --git a/demos/gtk-demo/move_cursor.png b/demos/gtk-demo/move_cursor.png
new file mode 100644 (file)
index 0000000..6028099
Binary files /dev/null and b/demos/gtk-demo/move_cursor.png differ
diff --git a/demos/gtk-demo/n_resize_cursor.png b/demos/gtk-demo/n_resize_cursor.png
new file mode 100644 (file)
index 0000000..fbd8420
Binary files /dev/null and b/demos/gtk-demo/n_resize_cursor.png differ
diff --git a/demos/gtk-demo/ne_resize_cursor.png b/demos/gtk-demo/ne_resize_cursor.png
new file mode 100644 (file)
index 0000000..0ca3f6e
Binary files /dev/null and b/demos/gtk-demo/ne_resize_cursor.png differ
diff --git a/demos/gtk-demo/nesw_resize_cursor.png b/demos/gtk-demo/nesw_resize_cursor.png
new file mode 100644 (file)
index 0000000..aa3bf68
Binary files /dev/null and b/demos/gtk-demo/nesw_resize_cursor.png differ
diff --git a/demos/gtk-demo/no_drop_cursor.png b/demos/gtk-demo/no_drop_cursor.png
new file mode 100644 (file)
index 0000000..4f9968f
Binary files /dev/null and b/demos/gtk-demo/no_drop_cursor.png differ
diff --git a/demos/gtk-demo/none_cursor.png b/demos/gtk-demo/none_cursor.png
new file mode 100644 (file)
index 0000000..ad0dae1
Binary files /dev/null and b/demos/gtk-demo/none_cursor.png differ
diff --git a/demos/gtk-demo/not_allowed_cursor.png b/demos/gtk-demo/not_allowed_cursor.png
new file mode 100644 (file)
index 0000000..1305af8
Binary files /dev/null and b/demos/gtk-demo/not_allowed_cursor.png differ
diff --git a/demos/gtk-demo/ns_resize_cursor.png b/demos/gtk-demo/ns_resize_cursor.png
new file mode 100644 (file)
index 0000000..acb1283
Binary files /dev/null and b/demos/gtk-demo/ns_resize_cursor.png differ
diff --git a/demos/gtk-demo/nw_resize_cursor.png b/demos/gtk-demo/nw_resize_cursor.png
new file mode 100644 (file)
index 0000000..6691557
Binary files /dev/null and b/demos/gtk-demo/nw_resize_cursor.png differ
diff --git a/demos/gtk-demo/nwse_resize_cursor.png b/demos/gtk-demo/nwse_resize_cursor.png
new file mode 100644 (file)
index 0000000..183001d
Binary files /dev/null and b/demos/gtk-demo/nwse_resize_cursor.png differ
diff --git a/demos/gtk-demo/pointer_cursor.png b/demos/gtk-demo/pointer_cursor.png
new file mode 100644 (file)
index 0000000..b510203
Binary files /dev/null and b/demos/gtk-demo/pointer_cursor.png differ
diff --git a/demos/gtk-demo/progress_cursor.png b/demos/gtk-demo/progress_cursor.png
new file mode 100644 (file)
index 0000000..7afe983
Binary files /dev/null and b/demos/gtk-demo/progress_cursor.png differ
diff --git a/demos/gtk-demo/row_resize_cursor.png b/demos/gtk-demo/row_resize_cursor.png
new file mode 100644 (file)
index 0000000..acb1283
Binary files /dev/null and b/demos/gtk-demo/row_resize_cursor.png differ
diff --git a/demos/gtk-demo/s_resize_cursor.png b/demos/gtk-demo/s_resize_cursor.png
new file mode 100644 (file)
index 0000000..5e6bf50
Binary files /dev/null and b/demos/gtk-demo/s_resize_cursor.png differ
diff --git a/demos/gtk-demo/se_resize_cursor.png b/demos/gtk-demo/se_resize_cursor.png
new file mode 100644 (file)
index 0000000..f6e4002
Binary files /dev/null and b/demos/gtk-demo/se_resize_cursor.png differ
diff --git a/demos/gtk-demo/sw_resize_cursor.png b/demos/gtk-demo/sw_resize_cursor.png
new file mode 100644 (file)
index 0000000..1963383
Binary files /dev/null and b/demos/gtk-demo/sw_resize_cursor.png differ
diff --git a/demos/gtk-demo/text_cursor.png b/demos/gtk-demo/text_cursor.png
new file mode 100644 (file)
index 0000000..53cec46
Binary files /dev/null and b/demos/gtk-demo/text_cursor.png differ
diff --git a/demos/gtk-demo/vertical_text_cursor.png b/demos/gtk-demo/vertical_text_cursor.png
new file mode 100644 (file)
index 0000000..17241bc
Binary files /dev/null and b/demos/gtk-demo/vertical_text_cursor.png differ
diff --git a/demos/gtk-demo/w_resize_cursor.png b/demos/gtk-demo/w_resize_cursor.png
new file mode 100644 (file)
index 0000000..65383b1
Binary files /dev/null and b/demos/gtk-demo/w_resize_cursor.png differ
diff --git a/demos/gtk-demo/wait_cursor.png b/demos/gtk-demo/wait_cursor.png
new file mode 100644 (file)
index 0000000..21ccd2f
Binary files /dev/null and b/demos/gtk-demo/wait_cursor.png differ
diff --git a/demos/gtk-demo/zoom_in_cursor.png b/demos/gtk-demo/zoom_in_cursor.png
new file mode 100644 (file)
index 0000000..ae3114d
Binary files /dev/null and b/demos/gtk-demo/zoom_in_cursor.png differ
diff --git a/demos/gtk-demo/zoom_out_cursor.png b/demos/gtk-demo/zoom_out_cursor.png
new file mode 100644 (file)
index 0000000..846a3dd
Binary files /dev/null and b/demos/gtk-demo/zoom_out_cursor.png differ